mardora 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +113 -0
  3. package/dist/chunk-3OCUX4OO.js +7690 -0
  4. package/dist/chunk-3OCUX4OO.js.map +1 -0
  5. package/dist/chunk-3ZOCCFDL.cjs +74 -0
  6. package/dist/chunk-3ZOCCFDL.cjs.map +1 -0
  7. package/dist/chunk-7JOEPNEV.cjs +7740 -0
  8. package/dist/chunk-7JOEPNEV.cjs.map +1 -0
  9. package/dist/chunk-BIKZQZ6W.js +33 -0
  10. package/dist/chunk-BIKZQZ6W.js.map +1 -0
  11. package/dist/chunk-EQJESPP2.js +234 -0
  12. package/dist/chunk-EQJESPP2.js.map +1 -0
  13. package/dist/chunk-G4SE26YY.js +70 -0
  14. package/dist/chunk-G4SE26YY.js.map +1 -0
  15. package/dist/chunk-KNDWF2DP.cjs +35 -0
  16. package/dist/chunk-KNDWF2DP.cjs.map +1 -0
  17. package/dist/chunk-MLBEBFHB.cjs +2971 -0
  18. package/dist/chunk-MLBEBFHB.cjs.map +1 -0
  19. package/dist/chunk-P7JFCYU3.js +905 -0
  20. package/dist/chunk-P7JFCYU3.js.map +1 -0
  21. package/dist/chunk-SWFUKJDO.cjs +243 -0
  22. package/dist/chunk-SWFUKJDO.cjs.map +1 -0
  23. package/dist/chunk-WFVCG4LD.cjs +926 -0
  24. package/dist/chunk-WFVCG4LD.cjs.map +1 -0
  25. package/dist/chunk-XL6WFGJT.js +2901 -0
  26. package/dist/chunk-XL6WFGJT.js.map +1 -0
  27. package/dist/editor/index.cjs +277 -0
  28. package/dist/editor/index.cjs.map +1 -0
  29. package/dist/editor/index.d.cts +186 -0
  30. package/dist/editor/index.d.ts +186 -0
  31. package/dist/editor/index.js +4 -0
  32. package/dist/editor/index.js.map +1 -0
  33. package/dist/index.cjs +405 -0
  34. package/dist/index.cjs.map +1 -0
  35. package/dist/index.d.cts +13 -0
  36. package/dist/index.d.ts +13 -0
  37. package/dist/index.js +8 -0
  38. package/dist/index.js.map +1 -0
  39. package/dist/lib/index.cjs +12 -0
  40. package/dist/lib/index.cjs.map +1 -0
  41. package/dist/lib/index.d.cts +16 -0
  42. package/dist/lib/index.d.ts +16 -0
  43. package/dist/lib/index.js +3 -0
  44. package/dist/lib/index.js.map +1 -0
  45. package/dist/mardora-DCwjomil.d.cts +640 -0
  46. package/dist/mardora-DCwjomil.d.ts +640 -0
  47. package/dist/plugins/index.cjs +104 -0
  48. package/dist/plugins/index.cjs.map +1 -0
  49. package/dist/plugins/index.d.cts +740 -0
  50. package/dist/plugins/index.d.ts +740 -0
  51. package/dist/plugins/index.js +7 -0
  52. package/dist/plugins/index.js.map +1 -0
  53. package/dist/preview/index.cjs +38 -0
  54. package/dist/preview/index.cjs.map +1 -0
  55. package/dist/preview/index.d.cts +101 -0
  56. package/dist/preview/index.d.ts +101 -0
  57. package/dist/preview/index.js +5 -0
  58. package/dist/preview/index.js.map +1 -0
  59. package/dist/types-NBsaxl4d.d.cts +71 -0
  60. package/dist/types-Pw2SWWAR.d.ts +71 -0
  61. package/package.json +92 -0
  62. package/src/editor/attachments/extension.ts +181 -0
  63. package/src/editor/attachments/format.ts +63 -0
  64. package/src/editor/attachments/index.ts +3 -0
  65. package/src/editor/attachments/types.ts +37 -0
  66. package/src/editor/heading-fold/config.ts +25 -0
  67. package/src/editor/heading-fold/extension.ts +268 -0
  68. package/src/editor/heading-fold/extract.ts +88 -0
  69. package/src/editor/heading-fold/index.ts +5 -0
  70. package/src/editor/heading-fold/theme.ts +85 -0
  71. package/src/editor/heading-fold/types.ts +24 -0
  72. package/src/editor/i18n.ts +13 -0
  73. package/src/editor/icons/index.ts +367 -0
  74. package/src/editor/index.ts +16 -0
  75. package/src/editor/mardora.ts +257 -0
  76. package/src/editor/media-lightbox-theme.ts +146 -0
  77. package/src/editor/media-lightbox.ts +125 -0
  78. package/src/editor/plugin.ts +294 -0
  79. package/src/editor/selection-toolbar/activation.ts +123 -0
  80. package/src/editor/selection-toolbar/commands.ts +279 -0
  81. package/src/editor/selection-toolbar/extension.ts +564 -0
  82. package/src/editor/selection-toolbar/i18n.ts +164 -0
  83. package/src/editor/selection-toolbar/index.ts +7 -0
  84. package/src/editor/selection-toolbar/menu.ts +252 -0
  85. package/src/editor/selection-toolbar/position.ts +43 -0
  86. package/src/editor/selection-toolbar/theme.ts +195 -0
  87. package/src/editor/selection-toolbar/types.ts +155 -0
  88. package/src/editor/slash/default-commands.ts +190 -0
  89. package/src/editor/slash/extension.ts +319 -0
  90. package/src/editor/slash/index.ts +7 -0
  91. package/src/editor/slash/insertions.ts +26 -0
  92. package/src/editor/slash/menu.ts +123 -0
  93. package/src/editor/slash/position.ts +61 -0
  94. package/src/editor/slash/query.ts +33 -0
  95. package/src/editor/slash/theme.ts +113 -0
  96. package/src/editor/slash/types.ts +40 -0
  97. package/src/editor/table-of-contents/extension.ts +202 -0
  98. package/src/editor/table-of-contents/extract.ts +53 -0
  99. package/src/editor/table-of-contents/index.ts +7 -0
  100. package/src/editor/table-of-contents/panel.ts +83 -0
  101. package/src/editor/table-of-contents/slug.ts +50 -0
  102. package/src/editor/table-of-contents/storage.ts +35 -0
  103. package/src/editor/table-of-contents/theme.ts +153 -0
  104. package/src/editor/table-of-contents/types.ts +44 -0
  105. package/src/editor/theme.ts +72 -0
  106. package/src/editor/utils.ts +176 -0
  107. package/src/editor/view-plugin.ts +189 -0
  108. package/src/index.ts +5 -0
  109. package/src/lib/index.ts +2 -0
  110. package/src/lib/input-handler.ts +47 -0
  111. package/src/plugins/code-plugin.theme.ts +545 -0
  112. package/src/plugins/code-plugin.ts +1892 -0
  113. package/src/plugins/emoji-plugin.ts +140 -0
  114. package/src/plugins/heading-plugin.ts +194 -0
  115. package/src/plugins/hr-plugin.ts +102 -0
  116. package/src/plugins/html-plugin.ts +353 -0
  117. package/src/plugins/image-plugin.ts +806 -0
  118. package/src/plugins/index.ts +71 -0
  119. package/src/plugins/inline-plugin.ts +311 -0
  120. package/src/plugins/link-plugin.ts +509 -0
  121. package/src/plugins/list-plugin.ts +492 -0
  122. package/src/plugins/math-plugin.ts +526 -0
  123. package/src/plugins/mermaid-plugin.ts +513 -0
  124. package/src/plugins/paragraph-plugin.ts +38 -0
  125. package/src/plugins/quote-plugin.ts +733 -0
  126. package/src/plugins/table-controls-theme.ts +126 -0
  127. package/src/plugins/table-controls.ts +423 -0
  128. package/src/plugins/table-model.ts +661 -0
  129. package/src/plugins/table-plugin.ts +2111 -0
  130. package/src/preview/context.ts +45 -0
  131. package/src/preview/css-generator.ts +64 -0
  132. package/src/preview/default-renderers.ts +29 -0
  133. package/src/preview/index.ts +29 -0
  134. package/src/preview/preview.ts +41 -0
  135. package/src/preview/renderer.ts +184 -0
  136. package/src/preview/syntax-theme.ts +112 -0
  137. package/src/preview/toc.ts +23 -0
  138. package/src/preview/types.ts +89 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Refinex-Space
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,113 @@
1
+ <h1 align="center">Mardora</h1>
2
+
3
+ <p align="center">
4
+ <strong>A framework-agnostic Markdown editor, plugin system, and static preview toolkit built on CodeMirror 6.</strong>
5
+ </p>
6
+
7
+ ## Overview
8
+
9
+ Mardora packages the Markdown editor capabilities used by the React, Vue2, and Vue3 playgrounds in this repository. It provides:
10
+
11
+ - CodeMirror 6 extension composition through `mardora()`.
12
+ - Rich Markdown editing decorations while preserving plain Markdown source.
13
+ - Built-in plugins for paragraphs, headings, inline formats, links, lists, tables, HTML, images, math, Mermaid, code blocks, quotes, GFM callouts, horizontal rules, and Emoji.
14
+ - Slash commands including Callout templates, browser attachment entry points, selected-text toolbar, editor TOC, UI locale support, and static preview rendering.
15
+ - Framework-neutral APIs for React, Vue, or plain CodeMirror integrations.
16
+
17
+ Applications remain responsible for layout, state management, persistence, auth, upload storage, file security, and published-content workflows.
18
+
19
+ ## Installation
20
+
21
+ ```bash
22
+ npm install mardora
23
+ ```
24
+
25
+ Mardora installs the CodeMirror 6 runtime packages it uses as pinned dependencies and re-exports common editor APIs from `mardora/editor`. Install additional CodeMirror language/theme packages only when your application builds optional output panels like the playground.
26
+
27
+ ## GFM Callouts
28
+
29
+ `QuotePlugin` recognizes GitHub Flavored Markdown callouts and renders `NOTE`, `TIP`, `IMPORTANT`, `WARNING`, and `CAUTION` as typed callout blocks in both edit-state decoration and static preview output.
30
+ Default slash commands include shortcuts for all five Callout types.
31
+
32
+ ```markdown
33
+ > [!NOTE]
34
+ > Useful context for readers.
35
+ ```
36
+
37
+ ## Quick Start
38
+
39
+ ```ts
40
+ import { EditorState, EditorView, mardora, ThemeEnum } from "mardora/editor";
41
+ import { allPlugins } from "mardora/plugins";
42
+
43
+ const parent = document.getElementById("editor");
44
+
45
+ if (!parent) {
46
+ throw new Error("Missing #editor container");
47
+ }
48
+
49
+ const view = new EditorView({
50
+ parent,
51
+ state: EditorState.create({
52
+ doc: "# Hello, Mardora",
53
+ extensions: [
54
+ mardora({
55
+ theme: ThemeEnum.AUTO,
56
+ plugins: allPlugins,
57
+ }),
58
+ ],
59
+ }),
60
+ });
61
+
62
+ // Call this when the owning component or page unmounts.
63
+ // view.destroy();
64
+ ```
65
+
66
+ ## Static Preview
67
+
68
+ ```ts
69
+ import { ThemeEnum } from "mardora/editor";
70
+ import { allPlugins } from "mardora/plugins";
71
+ import { generateCSS, preview } from "mardora/preview";
72
+
73
+ const html = await preview("# Hello", {
74
+ theme: ThemeEnum.LIGHT,
75
+ plugins: allPlugins,
76
+ sanitize: true,
77
+ wrapperTag: "article",
78
+ wrapperClass: "mardora-preview",
79
+ });
80
+
81
+ const css = generateCSS({
82
+ theme: ThemeEnum.LIGHT,
83
+ plugins: allPlugins,
84
+ wrapperClass: "mardora-preview",
85
+ includeBase: true,
86
+ });
87
+ ```
88
+
89
+ Use the same `plugins`, `theme`, syntax theme, and `wrapperClass` for `preview()` and `generateCSS()` so the generated HTML and CSS stay aligned.
90
+
91
+ ## Public Entrypoints
92
+
93
+ | Entrypoint | Purpose |
94
+ | -------------------------- | ------------------------------------------------------------------------------------------ |
95
+ | `mardora` | Aggregate export for quick experiments. |
96
+ | `mardora/editor` | Editor factory, config types, theme, i18n, attachments, slash, selection toolbar, and TOC. |
97
+ | `mardora/plugins` | Built-in plugins and `allPlugins`. |
98
+ | `mardora/preview` | Static HTML, CSS, and preview TOC helpers. |
99
+ | `mardora/lib` | Lower-level input helpers. |
100
+
101
+ ## Documentation
102
+
103
+ The repository README and guides contain the full production integration path:
104
+
105
+ - [README.md](https://github.com/Refinex-Space/mardora#readme)
106
+ - [Project introduction and API guide](https://github.com/Refinex-Space/mardora/blob/main/docs/guides/project-introduction.md)
107
+ - [React integration guide](https://github.com/Refinex-Space/mardora/blob/main/docs/guides/react-integration.md)
108
+ - [Vue2 integration guide](https://github.com/Refinex-Space/mardora/blob/main/docs/guides/vue2-integration.md)
109
+ - [Vue3 integration guide](https://github.com/Refinex-Space/mardora/blob/main/docs/guides/vue3-integration.md)
110
+
111
+ ## License
112
+
113
+ MIT